package com.mdd.front.controller.teacher;

import com.mdd.common.core.AjaxResult;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.front.LikeFrontThreadLocal;
import com.mdd.front.service.teacher.ITeacherService;
import com.mdd.front.vo.teacher.TeacherDetailVo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 讲师管理
 * @author panweiliang
 */
@RestController
@RequestMapping("/api/teacher")
public class TeacherController {

    @Resource
    ITeacherService iTeacherService;

    /**
     * 讲师详情
     *
     * @author panweiliang
     * @param id 主键ID
     * @return Object
     */
    @GetMapping("/detail")
    public Object detail(@Validated @IDMust() @RequestParam("id") Integer id) {
        Integer userId = LikeFrontThreadLocal.getUserId();
        TeacherDetailVo detail = iTeacherService.detail(id, userId);
        return AjaxResult.success(detail);
    }

}
